import { mapGetters } from 'vuex'

export default {
  computed: {
    ...mapGetters('m_message', ['total'])
  },
  watch: {
    total() {
      this.setBadge()
    }
  },
  onShow() {
    this.setBadge()
  },
  methods: {
    setBadge() {
		if( this.total==0){
			uni.setTabBarBadge({
			  index: 1,//索引
			  // text: this.total + ''
			  text:  ' '
			})
		}else{
			uni.setTabBarBadge({
			  index: 1,//索引
			  // text: this.total + ''
			  text: this.total + ''
			})
		}
      
    }
  }
}
